<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Jedrzej\Pimpable\PimpableTrait;

class TemplateMessage extends Model
{
    use HasFactory;
    use PimpableTrait;
    use SoftDeletes;


    public $searchable = [
        'name',
        'status'
    ];

    /**
     * 查询字段模式
     *
     *  nickname => '%field%' 模糊查询
     *  created_at= (ge)field
     * @var array
     */
    public $searchableModels = [
        'name' => '%field%'
    ];

    public $fillable = [
        'template_id',
        'type',
        'template_key',
        'name',
        'content',
        'status',
        'system_admin_id'
    ];

    public $casts = [
        'content' => 'array'
    ];

    public $sortable = [
        'template_id',
        'template_key',
    ];

    protected $defaultSortCriteria = ['id,desc'];
}
